import {sessionUtl} from "@/utils/sessionUtl";

export default {
    namespaced: true,
    state: {
        // 分类列表
        classifyList: sessionUtl.get('classifyList') || [],
        // 选中分类
        classifyNum: sessionUtl.get('classifyNum') || [],
    },
    actions: {},
    mutations: {
        /**
         *获取产品分类列表
         * @param state
         * @param classifyList
         */
        setClassifyList(state: any, classifyList: any) {
            sessionUtl.save('classifyList', classifyList);
            state.classifyList = classifyList;
            state.classifyId = classifyList[0]?.id;
        },
        setClassifyNum(state: any, num: number) {
            state.classifyNum = num;
            sessionUtl.save('classifyNum', num);
        }
    },
};